import 'package:sprintf/sprintf.dart';

String durationStr(int countdownNum) {
  if (countdownNum < 60) {
    return sprintf("00:%02d", [countdownNum]);
  } else if (countdownNum < 100 * 60) {
    int minute = countdownNum ~/ 60;
    int second = countdownNum % 60;
    return sprintf("%02d:%02d", [minute, second]);
  } else {
    int minute = countdownNum ~/ 60;
    int second = countdownNum % 60;
    return "$minute:${sprintf("%02d", [second])}";
  }
}

String timeStr(int time) {
  DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(time);
  return sprintf("%02d月%02d日 %02d:%02d", [dateTime.month, dateTime.day,dateTime.hour,dateTime.minute]);
}
